package park.model;

public class SungJukVO {
	// 멤버변수
	private String name;
	private int kor;
	private int eng;
	private int mat;
	private int tot;
	private double avg;
	private char grd;
	
	// 생성자
	public SungJukVO( 
		String name, int kor, int eng, int mat ) {
		this.name = name;
		this.kor = kor;
		this.eng = eng;
		this.mat = mat;
	}
	
	// 메서드
	// 멤버변수에 값을 저장하는 메서드 : setter
	// set멤버변수명(멤버변수자료형 멤버변수명)
	public void setName(String name) { this.name = name; }
	public void setKor(int kor) { this.kor = kor; }
	public void setEng(int eng) { this.eng = eng; }
	public void setMat(int mat) { this.mat = mat; }
		
	// 멤버변수의 값을 읽어오는 메서드 : getter
	// 멤버변수자료형 get멤버변수명() { return 멤버변수명; }
	public String getName() { return name; }
	public int getKor() { return kor; }
	public int getEng() { return eng; }
	public int getMat() { return mat; }
	
	public int getTot() { 
		tot = kor + eng + mat;	
		return tot;
	}
	public double getAvg() {
		avg = (double)tot / 3;
		return avg;
	}
	public char getGrd() {
		switch((int)getAvg()/10) {
			case 10:
			case 9: grd = '수'; break;
			case 8: grd = '우';	break;		
			case 7: grd = '미';	break;		
			case 6: grd = '양';	break;	
			default : grd = '가';	
		}
		return grd;
	}
	
	@Override
	public String toString() {
		String result = "";
		result += name +"/" + kor + "/" + eng + "/" + mat;
		result += "/" + getTot() + "/" + getAvg() + "/" + getGrd();
		return result;
	}
}






